//
//  LoadingContentTableDelegater.m
//  MyRail
//
//  Created by Ishra on 21/10/2008.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "LoadingContentTableDelegater.h"

#define ROW_HEIGHT 60

@implementation LoadingContentTableDelegater

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Only one section so return the number of items in the list
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {   
    UITableViewCell *cell = (UITableViewCell *) [tableView dequeueReusableCellWithIdentifier:@"LoadingDelegate"];
	
    if (cell == nil) {
		CGFloat rowHeight = tableView.rowHeight;
		CGFloat activityPosition = (rowHeight - 20) / 2;
		CGRect startingRect = CGRectMake(0.0, 0.0, 320.0, rowHeight);
        cell = [[[UITableViewCell alloc] initWithFrame:startingRect reuseIdentifier:@"LoadingDelegate"] autorelease];
		UIActivityIndicatorView *waiting = [[UIActivityIndicatorView alloc] initWithFrame: CGRectMake(280, activityPosition, 20, 20)];
		[waiting setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleGray];
		[waiting startAnimating];
		[cell addSubview:waiting];
		[waiting release];		
	}
    cell.text=@"Please wait...";
	cell.textColor = [UIColor darkGrayColor];
		
	return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath  {
}

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
	return nil;
}

@end
